#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 5;
int T,n,a[N],b[N],ans;
int c[N];
bool cmp(int x,int y) {
    return x > y;
}
int op(int x) {
    if(x == 1 || x == -1) return 0;
    return 1;
}
signed main() {
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    cin >> T;
    while(T--) {
        ans = 0;
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        memset(c,-1,sizeof(c));
        cin >> n;
        for(int i = 1; i <= n; i++) {
            cin >> a[i];
            b[a[i]]++;
        }
        for(int i = 1; i <= N; i++) {
            if(b[i] == 2)
                ans += i;
        }
        cout << ans << endl;
    }
    return 0;
}
